﻿-- =============================================
-- Author:		Andreas Könighofer (IT-eXperience)
-- Create date: 15.01.2009
-- Description:	Deletes all resources that match with the given parameters
-- =============================================
CREATE PROCEDURE [dbo].[DeleteResource] 
	-- Add the parameters for the stored procedure here
	@ResourceID INT = NULL
	, @LocationID SMALLINT = NULL
	, @ResourceName NVARCHAR(100) = NULL
	, @SSNo NVARCHAR(50) = NULL
	, @MachineTypeID SMALLINT = NULL
	, @Status NVARCHAR(50) = NULL
	, @SerialNo NVARCHAR(50) = NULL
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	DELETE FROM Resource
	WHERE ((@ResourceID IS NULL) OR (ResourceID = @ResourceID))
	AND ((@LocationID IS NULL) OR (LocationID = @LocationID))
	AND ((@ResourceName IS NULL) OR (RessourceName = @ResourceName))
	AND ((@SSNo IS NULL) OR (SSNo = @SSNo))
	AND ((@MachineTypeID IS NULL) OR (MachineTypeID = @MachineTypeID))
	AND ((@Status IS NULL) OR (Status = @Status))
	AND ((@SerialNo IS NULL) OR (SerialNo = @SerialNo))
END

---- end script DeleteResource stored procedure ----
---- end script delete stored procedures -------
---- end script stored procedures --------------

